home *** CD-ROM | disk | FTP | other *** search
/ Ray Dream Studio / Ray Dream Studio (CDRAYD1) (Ray Dream) (1995).iso / DREAMSDK.WIN / INCLUDE / QLIB.H < prev    next >
C/C++ Source or Header  |  1995-09-06  |  9KB  |  247 lines

  1. /* $Id: qlib.h 1.1 1995/06/29 09:36:47 YannPC Exp $ */
  2. #ifndef __QLIB__
  3. #define __QLIB__
  4.  
  5. #ifndef _WIN31
  6. #define __cdecl 
  7. #endif
  8.  
  9. #if defined(qFIXEDIsQuickFix) && defined(qNewQLib)
  10.  
  11. inline QuickFix QFM(const QuickFix &xx,const QuickFix &yy) {
  12. return xx*yy;
  13. }
  14.  
  15. inline QuickFix QFD(const QuickFix &xx,const QuickFix &yy) {
  16. return xx/yy;
  17. }
  18.  
  19. inline QuickFix QFDClip(const QuickFix &xx,const QuickFix &yy) {
  20. return xx/yy;
  21. }
  22.  
  23. inline QuickFix QFDNoClip(const QuickFix &xx,const QuickFix &yy) {
  24. return xx/yy;
  25. }
  26.  
  27. #elif defined(qQFixIsFloat) && defined(qNewQLib)
  28.  
  29. #define QFM(xx,yy) ((xx)*(yy))
  30. #define QFD(xx,yy) ((xx)/(yy))
  31. #define QFDClip(xx,yy) ((xx)/(yy))
  32. #define QFDNoClip(xx,yy) ((xx)/(yy))
  33.  
  34. #else
  35.  
  36. typedef struct QSegment {
  37.     long            order;
  38.     long            x1,y1;
  39.     long            x2,y2;
  40.     long            x3,y3;
  41.     long            x4,y4;
  42.     } QSegment;
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47.  
  48.     long QFDClip(long xx,long yy);
  49.     long QFD(long xx,long yy);
  50.     long QFMClip(long xx, long yy);
  51.  
  52.     long IntersectSegLine(const long *seg,const long *line);
  53.     long CalculateCurve(long P0,long P1,long P2,long lamda);
  54.     long CalculateBezier(long P0,long P1,long P2,long P3,long lamda);
  55.  
  56. #if defined(_WIN31) || defined(qPowerPC)
  57.     long __cdecl QFM(long xx,long yy);
  58.     long __cdecl QFMOV(long xx,long yy,short *overflow);
  59.     long __cdecl QLM(long xx,long yy,unsigned long *zzlow);
  60.     long __cdecl QFDNoClip(long xx,long yy);
  61.     
  62.     void  SubLine(const QSegment *seg,QSegment *left,QSegment *right);
  63.     void  SubCurve(const QSegment *seg,QSegment *left,QSegment *right);
  64.     void  SubBezier(const QSegment *seg,QSegment *left,QSegment *right);
  65. #endif
  66.  
  67. #ifdef __cplusplus
  68.     }
  69. #endif
  70.  
  71.  
  72. #if !defined(_WIN31) && !defined(qPowerPC)
  73.  
  74. long QFMOV(long xx, long yy, short* overflow) = {
  75. 0x2217,                                    //MOVE.L     (A7),D1
  76. 0x4C2F,0x1C00,0x0004,        //MULS.L     $0004(A7),D0:D1
  77. 0x4840,                                    //SWAP       D0
  78. 0x4841,                                    //SWAP       D1
  79. 0x206F,0x0008,                    //MOVEA.L    $0008(A7),A0
  80. 0X3080,                                    //MOVE.W     D0,(A0)
  81. 0x3001                                    //MOVE.W     D1,D0
  82. };
  83.  
  84. long QFM(long xx, long yy) = {
  85. 0x2217,                                    //MOVE.L     (A7),D1
  86. 0x4C2F,0x1C00,0x0004,        //MULS.L     $0004(A7),D0:D1
  87. 0x4840,                                    //SWAP       D0
  88. 0x4841,                                    //SWAP       D1
  89. 0x3001                                    //MOVE.W     D1,D0
  90. };
  91.  
  92. long QFDNoClip(long xx,long yy) = {
  93. 0x2017,                                    //MOVE.L     (A7),D0
  94. 0x2200,                                    //MOVE.L     D0,D1
  95. 0xE188,                                    //LSL.L      #$8,D0
  96. 0xE188,                                    //LSL.L      #$8,D0
  97. 0xE081,                                    //ASR.L      #$8,D1
  98. 0xE081,                                    //ASR.L      #$8,D1
  99. 0x4C6F,0x0C01,0x0004        //DIVS.L     $0004(A7),D1:D0
  100. };
  101.  
  102.  
  103. long QLM(long xx,long yy,unsigned long *low) = {
  104. 0x2217,                                    //MOVE.L     (A7),D1
  105. 0x4C2F,0x1C00,0x0004,        //MULS.L     $0004(A7),D0:D1
  106. 0x206F,0x0008,                    //MOVEA.L    $0008(A7),A0
  107. 0x2081                                    //MOVE.L     D1,(A0)
  108. };
  109.  
  110.  
  111.  
  112. void SubLine(const QSegment *seg,QSegment *left,QSegment *right) = {
  113. 0x2F0A,                                            //MOVE.L     A2,-(A7)
  114. 0x206F,0x0004,                            //MOVEA.L    $0004(A7),A0
  115. 0x226F,0x0008,                            //MOVEA.L    $0008(A7),A1
  116. 0x246F,0x000C,                            //MOVEA.L    $000C(A7),A2
  117. 0x2368,0x0004,0x0004,                //MOVE.L     $0004(A0),$0004(A1)
  118. 0x2368,0x0008,0x0008,                //MOVE.L     $0008(A0),$0008(A1)
  119. 0x2568,0x000C,0x000C,                //MOVE.L     $000C(A0),$000C(A2)
  120. 0x2568,0x0010,0x0010,                //MOVE.L     $0010(A0),$0010(A2)
  121. //0x2010,                                            //MOVE.L     (A0),D0
  122. 0x2028, 0x0004,                            // MOVE.L     $0004(A0),D0  YC
  123. 0xD0A8,0x000C,                            //ADD.L      $000C(A0),D0
  124. 0xE280,                                            //ASR.L      #$1,D0
  125. 0x2340,0x000C,                            //MOVE.L     D0,$000C(A1)
  126. //0x2480,                                            //MOVE.L     D0,(A2)
  127. 0x2540, 0x0004,                  //MOVE.L     D0,$0004(A2)    YC
  128. 0x2028,0x0008,                            //MOVE.L     $0008(A0),D0
  129. 0xD0A8,0x00010,                            //ADD.L      $0010(A0),D0
  130. 0xE280,                                            //ASR.L      #$1,D0
  131. 0x2340,0x0010,                            //MOVE.L     D0,$0010(A1)
  132. 0x2540,0x0008,                            //MOVE.L     D0,$0008(A2)
  133. 0x245F                                            //MOVEA.L    (A7)+,A2
  134. };
  135.  
  136. void SubCurve(const QSegment *seg,QSegment *left,QSegment *right) = {
  137. 0x2F0A,                                            //MOVE.L     A2,-(A7)
  138. 0x206F,0x0004,                            //MOVEA.L    $0004(A7),A0
  139. 0x226F,0x0008,                            //MOVEA.L    $0008(A7),A1
  140. 0x246F,0x000C,                            //MOVEA.L    $000C(A7),A2
  141. 0x2368,0x0004,0x0004,                //MOVE.L     $0004(A0),$0004(A1)
  142. 0x2368,0x0008,0x0008,                //MOVE.L     $0008(A0),$0008(A1)
  143. 0x2568,0x0014,0x0014,                //MOVE.L     $0014(A0),$0014(A2)
  144. 0x2568,0x0018,0x0018,                //MOVE.L     $0018(A0),$0018(A2)
  145. //0x2010,                                            //MOVE.L     (A0),D0
  146. 0x2028, 0x0004,                      //MOVE.L     $0004(A0),D0  YC
  147. 0xD0A8,0x000C,                            //ADD.L      $000C(A0),D0
  148. 0xE280,                                            //ASR.L      #$1,D0
  149. 0x2340,0x000C,                            //MOVE.L     D0,$000C(A1)
  150. 0x2028,0x0008,                            //MOVE.L     $0008(A0),D0
  151. 0xD0A8,0x0010,                            //ADD.L      $0010(A0),D0
  152. 0xE280,                                            //ASR.L      #$1,D0
  153. 0x2340,0x0010,                            //MOVE.L     D0,$0010(A1)
  154. 0x2028,0x000C,                            //MOVE.L     $000C(A0),D0
  155. 0xD0A8,0x0014,                            //ADD.L      $0014(A0),D0
  156. 0xE280,                                            //ASR.L      #$1,D0
  157. 0x2540,0x000C,                            //MOVE.L     D0,$000C(A2)
  158. 0x2028,0x0010,                            //MOVE.L     $0010(A0),D0
  159. 0xD0A8,0x0018,                            //ADD.L      $0018(A0),D0
  160. 0xE280,                                            //ASR.L      #$1,D0
  161. 0x2540,0x0010,                            //MOVE.L     D0,$0010(A2)
  162. 0x2029,0x000C,                            //MOVE.L     $000C(A1),D0
  163. 0xD0AA,0x000C,                            //ADD.L      $000C(A2),D0
  164. 0xE280,                                            //ASR.L      #$1,D0
  165. 0x2340,0x0014,                            //MOVE.L     D0,$0014(A1)
  166. //0x2480,                                            //MOVE.L     D0,(A2)
  167. 0x2540, 0x0004,                  //MOVE.L     D0,$0004(A2)    YC
  168. 0x2029,0x0010,                            //MOVE.L     $0010(A1),D0
  169. 0xD0AA,0x0010,                            //ADD.L      $0010(A2),D0
  170. 0xE280,                                            //ASR.L      #$1,D0
  171. 0x2340,0x0018,                            //MOVE.L     D0,$0018(A1)
  172. 0x2540,0x0008,                            //MOVE.L     D0,$0008(A2)
  173. 0x245F                                            //MOVEA.L    (A7)+,A2
  174. };
  175.  
  176. void SubBezier(const QSegment *seg,QSegment *left,QSegment *right) = {
  177. 0x2F0A,                                                //MOVE.L     A2,-(A7)
  178. 0x206F,0x0004,                                //MOVEA.L    $0004(A7),A0
  179. 0x226F,0x0008,                                //MOVEA.L    $0008(A7),A1
  180. 0x246F,0x000C,                                //MOVEA.L    $000C(A7),A2
  181. 0x2368,0x0004,0x0004,                    //MOVE.L     $0004(A0),$0004(A1)
  182. 0x2368,0x0008,0x0008,                    //MOVE.L     $0008(A0),$0008(A1)
  183. 0x2568,0x001C,0x001C,                    //MOVE.L     $001C(A0),$001C(A2)
  184. 0x2568,0x0020,0x0020,                    //MOVE.L     $0020(A0),$0020(A2)
  185. //0x2010,                                                //MOVE.L     (A0),D0
  186. 0x2028, 0x0004,                          //MOVE.L     $0004(A0),D0   YC
  187. 0xD0A8,0x000C,                                //ADD.L      $000C(A0),D0
  188. 0xE280,                                                //ASR.L      #$1,D0
  189. 0x2340,0x000C,                                //MOVE.L     D0,$000C(A1)
  190. 0x2028,0x0008,                                //MOVE.L     $0008(A0),D0
  191. 0xD0A8,0x0010,                                //ADD.L      $0010(A0),D0
  192. 0xE280,                                                //ASR.L      #$1,D0
  193. 0x2340,0x0010,                                //MOVE.L     D0,$0010(A1)
  194. 0x2028,0x0014,                                //MOVE.L     $0014(A0),D0
  195. 0xD0A8,0x001C,                                //ADD.L      $001C(A0),D0
  196. 0xE280,                                                //ASR.L      #$1,D0
  197. //0x2540,0x0010,                                //MOVE.L     D0,$0010(A2)
  198. 0x2540,0x0014,                                //MOVE.L     D0,$0014(A2)    YC
  199. 0x2028,0x0018,                                //MOVE.L     $0018(A0),D0
  200. 0xD0A8,0x0020,                                //ADD.L      $0020(A0),D0
  201. 0xE280,                                                //ASR.L      #$1,D0
  202. 0x2540,0x0018,                                //MOVE.L     D0,$0018(A2)
  203. 0x2228,0x000C,                                //MOVE.L     $000C(A0),D1
  204. 0xD2A8,0x0014,                                //ADD.L      $0014(A0),D1
  205. 0xE281,                                                //ASR.L      #$1,D1
  206. 0x2029,0x000C,                                //MOVE.L     $000C(A1),D0
  207. 0xD081,                                                //ADD.L      D1,D0
  208. 0xE280,                                                //ASR.L      #$1,D0
  209. 0x2340,0x0014,                                //MOVE.L     D0,$0014(A1)
  210. 0x202A,0x0014,                                //MOVE.L     $0014(A2),D0
  211. 0xD081,                                                //ADD.L      D1,D0
  212. 0xE280,                                                //ASR.L      #$1,D0
  213. 0x2540,0x000C,                                //MOVE.L     D0,$000C(A2)
  214. 0x2228,0x0010,                                //MOVE.L     $0010(A0),D1
  215. 0xD2A8,0x0018,                                //ADD.L      $0018(A0),D1
  216. 0xE281,                                                //ASR.L      #$1,D1
  217. 0x2029,0x0010,                                //MOVE.L     $0010(A1),D0
  218. 0xD081,                                                //ADD.L      D1,D0
  219. 0xE280,                                                //ASR.L      #$1,D0
  220. 0x2340,0x0018,                                //MOVE.L     D0,$0018(A1)
  221. 0x202A,0x0018,                                //MOVE.L     $0018(A2),D0
  222. 0xD081,                                                //ADD.L      D1,D0
  223. 0xE280,                                                //ASR.L      #$1,D0
  224. 0x2540,0x0010,                                //MOVE.L     D0,$0010(A2)
  225. 0x2029,0x0014,                                //MOVE.L     $0014(A1),D0
  226. 0xD0AA,0x000C,                                //ADD.L      $000C(A2),D0
  227. 0xE280,                                                //ASR.L      #$1,D0
  228. 0x2340,0x001C,                                //MOVE.L     D0,$001C(A1)
  229. //0x2480,                                                //MOVE.L     D0,(A2)
  230. 0x2540, 0x0004,                      //MOVE.L     D0,$0004(A2)    YC
  231. 0x2029,0x0018,                                //MOVE.L     $0018(A1),D0
  232. 0xD0AA,0x0010,                                //ADD.L      $0010(A2),D0
  233. 0xE280,                                                //ASR.L      #$1,D0
  234. 0x2340,0x0020,                                //MOVE.L     D0,$0020(A1)
  235. 0x2540,0x0008,                                //MOVE.L     D0,$0008(A2)
  236. 0x245F                                                //MOVEA.L    (A7)+,A2
  237. };
  238. #endif
  239.  
  240. #endif
  241.  
  242. #endif
  243.  
  244.  
  245.  
  246.  
  247.